C C -C Programming /C Questions and Answers OOPs Basic Concepts Sample Test,Sample questions

Question:
 Class is pass by _______

1.Value

2.Reference

3.Value or Reference depending on program

4.Copy


Question:
 How many classes can be defined in a single program?

1.Only 1

2. Only 100

3.Only 999

4. As many as you want


Question:
 If a local class is defined in a function which of the following is true for an object of that class?

1.Object is accessible outside the function

2.Object can be declared inside any other function

3.Object can be used to call other class members

4.Object can be used/accessed/declared locally in that function


Question:
 What is the scope of a class nested inside another class?

1.Protected scope

2.Private scope

3.Global scope

4.Depends on access specifier and inheritance used


Question:
 Which among the following is false for class features?

1.Classes may/may not have both data members and member functions

2.Class definition must be ended with a colon

3.Class can have only member functions with no data members

4.Class is similar to union and structures


Question:
 Which among the following is false?

1.Object must be created before using members of a class

2.Memory for an object is allocated only after its constructor is called

3.Objects can t be passed by reference

4.Objects size depends on its class data members


Question:
 Which among the following is wrong?

1.class student{ } student s

2. abstract class student{ } student s

3.abstract class student{ }s[50000000]

4.abstract class student{ } class toppers: public student{ } topper t


Question:
 Which concept of OOP is false for C++?

1.Code can be written without using classes

2.Code must contain at least one class

3.A class must have member functions

4.At least one object should be declared in code


Question:
 Which feature allows open recursion among the following?

1.Use of this pointer

2.Use of pointers

3.Use of pass by value

4.Use of parameterized constructor


Question:
 Which is not feature of OOP in general definitions?

1.Code reusability

2.Modularity

3. Duplicate/Redundant data

4.Efficient Code


Question:
 Which of the following best defines a class?

1.Parent of an object

2. Instance of an object

3. Blueprint of an object

4. Scope of an object


Question:
 Which of the following pairs are similar?

1.Class and object

2.Class and structure

3.Structure and object

4.Structure and functions


Question:
How many objects can be declared of a specific class in a single program?

1.32768

2.127

3.1

4.As many as you want


Question:
How members of an object are accessed?

1. Using dot operator/period symbol

2.Using scope resolution operator

3.Using member names directly

4.Using pointer only


Question:
Instance of which type of class can t be created?
 

1.Anonymous class

2.Nested class

3.Parent class

4.Abstract class


Question:
Object declared in main() function _____________

1.Can be used by any other function

2.Can be used by main() function of any other program

3.Can t be used by any other function

4. Can be accessed using scope resolution operator


Question:
Size of a class is _____________

1.Sum of the size of all the variables declared inside the class

2.Sum of the size of all the variables along with inherited variables in the class

3.Size of the largest size of variable

4.Classes doesn t have any size


Question:
The object can t be __________

1.Passed by reference

2.Passed by value

3.Passed by copy

4.Passed as function


Question:
What is default access specifier for data members or member functions declared within a class without any specifier in C++?

1.Private

2.Protected

3.Public

4.Depends on compiler


Question:
What is size of the object of following class (64 bit system)? class student {  int rollno   char  name[20]   static int studentno   } 

1.20

2.22

3.24

4.28


Question:
What is the additional feature in classes that was not in structures?

1.Data members

2.Member functions

3.Static data allowed

4.Public access specifier


Question:
When an object is returned___________

1.A temporary object is created to return the value

2. The same object used in function is used to return the value

3.The Object can be returned without creation of temporary object

4.Object are returned implicitly we can t say how it happens inside program


Question:
When OOP concept did first came into picture?

1.1970 s

2.1980 s

3.1993

4.1995


Question:
Which among following is correct for initializing the class below? class student{
int marks 
int cgpa 
public: student(int i int  j){
marks=I 
cgpa=j
}
} 

1.student s[3]={ s(394 9) s(394 9) s(394,9) }

2.student s[2]={ s(394,9) s(222,5) }

3.student s[2]={ s1(392,9) s2(222,5) }

4.student s[2]={ s[392,9] s2[222,5] }


Question:
Which among the following is correct?

1.class student{ }s1,s2 s1.student()=s2.student()

2.class student{ }s1 class topper{ }t1 s1=t1

3.class student{ }s1,s2 s1=s2

4.class student{ }s1 class topper{ }t1 s1.student()=s2.topper()


Question:
Which among the following is false for a member function of a class?

1. All member functions must be defined

2.Member functions can be defined inside or outside the class body

3.Member functions need not be declared inside the class definition

4.Member functions can be made friend to another class using the friend keyword


Question:
Which class can have member functions without their implementation?

1.Default class

2.String class

3. Template class

4.Abstract class


Question:
Which definition best describes an object?

1.Instance of a class

2.Instance of itself

3.Child of a class

4.Overview of a class


Question:
Which Feature of OOP illustrated the code reusability?

1.Polymorphism

2.Abstraction

3.Encapsulation

4.Inheritance


Question:
Which header file is required in C++ to use OOP?

1.iostream.h

2.stdio.h

3.stdlib.h

4.OOP can be used without using any header file


Question:
Which is known as a generic class?
) 

1.Abstract class

2.Final class

3.Template class

4.Efficient Code


Question:
Which language does not support all 4 types of inheritance?

1.C++

2.Java

3.Kotlin

4.Small Talk


Question:
Which of the following describes a friend class?

1.Friend class can access all the private members of the class of which it is a friend

2.Friend class can only access protected members of the class of which it is a friend

3.Friend class don t have any implementation

4.Friend class can t access any data member of another class but can use it s methods


Question:
Which of the following is incorrect?

1.class student{ }s

2.class student{ } student s

3.class student{ }s[]

4.class student{ } student s[5]


Question:
Which of the following is not type of class?

1.Abstract Class

2.Final Class

3.Start Class

4.String Class


Question:
Which of the two features match each other?

1.Inheritance and Encapsulation

2.Encapsulation and Polymorphism

3. Encapsulation and Abstraction

4. Abstraction and Polymorphism


Question:
Which syntax for class definition is wrong?

1.class student{ }

2.student class{ }

3.class student{ public: student(int a){ } }

4.class student{ student(int a){} }


Question:
Which was the first purely object oriented programming language developed?

1.Java

2.C++

3.SmallTalk

4.Kotlin


Question:
Who invented OOP?

1.Alan Kay

2.Andrea Ferro

3.Dennis Ritchie

4.Adele Goldberg


Question:
Why Java is Partially OOP language?

1.It supports usual declaration of primitive data types

2.It doesn t support all types of inheritance

3. It allows code to be written outside classes

4.It does not support pointers


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
  24. C MCQS:-The ABC of C
  25. C MCQS Interview Questions
  26. C++ Questions and Answers OOPs Basic Concepts
  27. C++ Questions and Answers Returning Objects
  28. C Programming MCQ Part 1
  29. C Programming MCQ
  30. Computer Science & Engineering C Multiple Choice Questions set 1
  31. Computer Science & Engineering C Multiple Choice Questions set 2
  32. C Multiple Choice Questions C Functions Set 1
  33. C Multiple Choice Questions C Functions Set 2
  34. C Multiple Choice Questions C Operators
  35. C Multiple Choice Questions & AnswersConditional Expressions
  36. C Multiple Choice Questions & Answers Data Types
  37. C Multiple Choice Questions & Answers File Access
  38. Computer Science & Engineering Cloud Computing MCQs Part 1
  39. CPP Programming MCQ Set 1
  40. CPP Programming MCQ Set 2
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!